This page last changed on Dec 19, 2007 by aaime.
Creating a new Data Directory
| Data Directory Contents
|
Create a new empty directory
To make a new GeoServer Data Directory, you must first create a new directory somewhere on your computer. For this example let's say it's at:
Linux:
/home/cholmes/gs-conf/
Windows:
C:\data_dir\
But you can really put it anywhere, you just have to point to it.
Find your geoserver install
To create your data directory you must copy a set of files from your current GeoServer installation. To do this find the location of GeoServer.
In binary releases this will be:
[install location]/webapps/geoserver/conf
In the Windows installer release this will be:
[install location]/data_dir
In war installations it will be in the webapps directory of your servlet containers:
[servlet container location]/webapps/geoserver/conf
Data Directory Contents
Your data directory should look like this:
Copy services.xml and catalog.xml
The first two files to copy into your data directory are services.xml and catalog.xml, which are found in an existing geoserver data directory or [geoserver_install]/webapps/geoserver/WEB-INF. Copy them to the top of your directory, so you have:
/home/cholmes/gs-conf/catalog.xml
and
/home/cholmes/gs-conf/services.xml
Copy the contents of the rest of the data directory
Next you want to copy the other sub-directories of the already defined data directory, found at [geoserver_install]/webapps/geoserver/conf, to your new data directory.
These directories are:
The ones that are absolutely required are:
The data/ and coverage/ directories listed above are just arbitrarily named directories that hold sample data. You can name them something else if you wish.
Fix relative paths
If you need your data directory to be easily moved around from one server to another, you have to make the file paths independent of the current absolute location on the disk.
This can be achieved by putting all your file based data (shapefile, coverages) in the data directory and by referring to them with special relative paths.
Please not this is not necessary, absolute path are fine, this step is just needed if you want the data dir to be easily moved to other servers.
You can define shapefiles (and indeed all geographic files) in one of two ways, either with the absolute path:
file:/C:/Documents and Settings/Chris/My Documents/shapefiles/states.shp
Or a relative one:
file:data/actual_datasets/tutorial.shp
These paths live in the catalog.xml file.
The relative one is still in relation to the data/ directory, so if you have relative shapefiles, you'll have to create a directory called data/ in your GeoServer data directory. Then you copy over all of the locations of your shapefiles. One of the ways that we used to recommend was putting this all in your featureTypes directory. If you did that, the easy way is to just also copy your featureTypes directory to data/ and everything should read fine. You should eventually move towards just defining your data directories within data/, and then point your DataStores directly at them.
|